<template>
  <div class="about">
    <h1>This is an about page. font color = {{ state.color }}</h1>
  </div>
</template>

<script lang="ts" setup>
  import { onMounted, reactive, defineProps } from 'vue'

  // const props = defineProps({
  //   name: String,
  //   title: String,
  //   content: {
  //     type: String,
  //     required: true,
  //     default: () => '123'
  //   }
  // })

  const props = defineProps<{
    name?: string
    title?: string
    content?: string
  }>()

  const state = reactive({
    color: '#ccc'
  })

  setTimeout(() => {
    state.color = 'red'
  }, 3000)
  ;(function (a: number) {
    // TODO 必须加分号，否则可能报错（前面有未加分号的执行函数）
    console.log(a)
  })(123)
  ;(function (a) {
    console.log(a)
  })(123)

  onMounted(() => {
    console.log(props.name)
  })

  // 块级作用域写法
  {
    let tmp = 88009991n
    console.log(tmp)
  }
</script>

<style lang="scss" scoped>
  h1 {
    color: v-bind('state.color');
  }
</style>
